package ${controllerPackageName};

import ${integrationPackageName}.${entity}Integration;
import ${VO}.${entity}VO;
import ${KeyVO}.${entity}KeyVO;
import ${SaveVO}.${entity}SaveVO;
import com.github.pagehelper.PageInfo;
import com.bifang.common.vo.AppResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * ${table.comment!}前端控制器
 *
 * @author ${author}
 * @since ${date}
 */
@RestController
@RequestMapping(value = "${controllerPath}")
public class ${table.controllerName} {

    @Autowired
    public ${entity}Integration ${table.entityPath}Integration;

    @ApiOperation(value = "${table.comment!}分页查询", notes = "${table.comment!}分页查询")
    @PostMapping(value = "/query/getList", produces = "application/json;charset=UTF-8")
    public AppResponse${"<"}PageInfo${"<"}${entity}VO${">>"} getList(@RequestBody ${entity}VO vo) {
        return AppResponse.successData(${table.entityPath}Integration.getList(vo));
    }

    @ApiOperation(value = "${table.comment!}根据主键查询", notes = "${table.comment!}根据主键查询")
    @PostMapping(value = "/query/getById", produces = "application/json;charset=UTF-8")
    public AppResponse${"<"}${entity}VO${">"} getById(@RequestBody ${entity}KeyVO vo) {
        return AppResponse.successData(${table.entityPath}Integration.getById(vo));
    }

    @ApiOperation(value = "${table.comment!}保存", notes = "${table.comment!}保存")
    @PostMapping(value = "/save", produces = "application/json;charset=UTF-8")
    public AppResponse save(@RequestBody ${entity}SaveVO vo) {
        ${table.entityPath}Integration.save(vo);
        return AppResponse.success();
    }

    @ApiOperation(value = "${table.comment!}根据主键修改", notes = "${table.comment!}根据主键修改")
    @PostMapping(value = "/update/updateById", produces = "application/json;charset=UTF-8")
    public AppResponse updateById(@RequestBody ${entity}SaveVO vo) {
        ${table.entityPath}Integration.updateById(vo);
        return AppResponse.success();
    }

    @ApiOperation(value = "${table.comment!}根据主键删除", notes = "${table.comment!}根据主键删除")
    @PostMapping(value = "/delete/removeById", produces = "application/json;charset=UTF-8")
    public AppResponse removeById(@RequestBody ${entity}KeyVO vo) {
        ${table.entityPath}Integration.removeById(vo);
        return AppResponse.success();
    }
}
